package com.bike.enumItem;

import java.util.HashMap;
import java.util.Map;

public enum BikeArrangEnum {
	SUCCESS(0,"正常"), 
	INVI_ERROR(1,"预约中"),
	CODE_ERROR(2,"取消预约"),
	lock(4,"已关锁"),
	UPDATE_ERROR(3,"已开锁");
	
	int code;
	String msg;
	
	BikeArrangEnum(int code,String msg){
		this.code=code;
		this.msg=msg;
	}
	public int getCode(){
		return code;
	}
	public static String getMsg(int code){
		for(BikeArrangEnum rce:BikeArrangEnum.values()){
			if(rce.code==code){
				return rce.getMsg();
			}
		}
		return "";
	}
	public String getMsg(){
		return msg;
	}
	public static Map<String,Object> getMapForCode(BikeArrangEnum codeEnum){
		Map<String,Object> map=new HashMap<String, Object>();
		for(BikeArrangEnum rce:BikeArrangEnum.values()){
			if(rce==codeEnum){
				map.put("code", rce.code);		
				map.put("msg", rce.msg);		
				break;
			}
		}
		return map;
	}
}
